package com.xbongbong.saas.model;

import com.xbongbong.paas.enums.DelEnum;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.wrap.IModel;
import com.xbongbong.pro.domain.entity.UpdateDataEntity;
import com.xbongbong.saas.domain.entity.PaymentTaskSubDataEntity;
import org.elasticsearch.action.support.WriteRequest;

import java.util.List;
import java.util.Map;

/**
 * @author: xingxing.xiao
 * @date: 2020/12/01 14:19
 */
public interface PaymentTaskSubDataModel extends IModel<PaymentTaskSubDataEntity> {
    @Override
    Integer insert(PaymentTaskSubDataEntity entity) throws XbbException;

    @Override
    Integer update(PaymentTaskSubDataEntity entity) throws XbbException;

    @Override
    List<PaymentTaskSubDataEntity> findEntitys(Map<String, Object> param);

    @Override
    Integer getEntitysCount(Map<String, Object> param);

    Integer insertBatch(List<PaymentTaskSubDataEntity> entities) throws XbbException;

    List<PaymentTaskSubDataEntity> getByDataId(Long dataId, String corpid);

    List<PaymentTaskSubDataEntity> getByDataIds(List<Long> dataIds, String corpid, DelEnum delEnum);

    Integer updateBatch(List<UpdateDataEntity> updateDataList, String corpid) throws XbbException;

    Integer deleteBatch(String corpid, List<PaymentTaskSubDataEntity> entities, WriteRequest.RefreshPolicy refreshPolicy) throws XbbException;

    Integer deleteByDataId(Long dataId, String corpid) throws XbbException;

    Integer deleteBatchByDataId(List<Long> dataIds, String corpid, DelEnum delEnum) throws XbbException;

    void restoreBatch(List<Long> dataIds, String corpid) throws XbbException;

    /**
     * 根据id删除子表单数据
     *
     * @param paymentTaskSubDataIdMap
     * @param corpid 公司id
     * @return
     */
    Integer deleteBatchByIdIn(Map<Long, Long> paymentTaskSubDataIdMap, String corpid) throws XbbException;

    /**
     * 更新回款计划子表单得数据
     *
     * @param updatePaymentTaskSubDataList
     * @param corpid 公司id
     * @return
     */
    Integer updateBatchByEntity(List<PaymentTaskSubDataEntity> updatePaymentTaskSubDataList, String corpid) throws XbbException;

    /**
     * 无差别更新回款计划子表单数据
     *
     * @param paymentTaskSubDataEntities
     */
    void updateAllBatch(List<PaymentTaskSubDataEntity> paymentTaskSubDataEntities) throws XbbException;

    /**
     * 无差别插入回款计划子表单信息
     *
     * @param paymentTaskSubDataInsertList
     */
    void insertAllBatch(List<PaymentTaskSubDataEntity> paymentTaskSubDataInsertList) throws XbbException;

    /**
     * 更新del
     * @param updateDelList
     * @param corpid
     * @param refreshPolicy
     * @param delEnum
     * @return
     * @throws XbbException
     */
    Integer updateDel(List<PaymentTaskSubDataEntity> updateDelList, String corpid, WriteRequest.RefreshPolicy refreshPolicy, DelEnum delEnum) throws XbbException;
}
